/**
 *
 */

import Factor from '../data/Factor'

class Table {
  /* properties */

  key

  // 条件因子
  factors = {
    col: [], // 列因子
    row: [], // 行因子
  }

  // 结果因子
  results = {
    col: [], // 列结果因子
    cell: [], // 单元格结果因子
  }

  // 规则行记录
  records = []

  /* static methods */

  createTableKey() {
    return 't1'
  }

  /* lefecycle methods */

  //
  constructor({ colFactors = [], rowFactors = [], colResults = [], cellResults = [] } = {}) {
    //
    this.key = Table.createTableKey()

    this.factors = this.initFactors({ colFactors, rowFactors })
    this.results = this.initResults({ colResults, cellResults })
  }

  /* public methods */

  /* private methods */

  initFactors({ colFactors = [], rowFactors = [] } = {}) {
    //

    return {
      col: [],
      row: [],
    }
  }

  initResults({ colResults = [], cellResults = [] } = {}) {
    //
  }

  // 创建一个 factor
  buildFactor(factorData = {}) {
    return new Factor()
  }

  /* getters */

  /* setters */
}

export default Table
